package com.glink.manage.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.glink.common.exception.GeneralSimpleException;
import com.glink.manage.domain.TemporaryAdmissionBean;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glink.manage.dto.temporaryadmission.*;
import com.glink.manage.vo.barriergate.PersonSyncDetailInfoVO;
import com.glink.manage.vo.constructionwork.ConstructionWorkListVO;
import com.glink.manage.vo.temporaryadmission.TemporaryAdmissionCarBaseVO;
import com.glink.manage.vo.temporaryadmission.TemporaryAdmissionCheckWorkVO;
import com.glink.manage.vo.temporaryadmission.TemporaryAdmissionPageVO;
import com.glink.manage.vo.temporaryadmission.TemporaryAdmissionPersonBaseVO;

import java.util.Date;
import java.util.List;

/**
 * @author  qiushaoshan
 * @since  2025-03-04
 */
public interface TemporaryAdmissionService extends IService<TemporaryAdmissionBean> {


    /**
     * 新增人员临时准入信息
     * @param dto 临时准入信息
     * @return 临时准入ID
     */
    String insertPerson(TemporaryAdmissionPersonSaveDTO dto) throws GeneralSimpleException;

    /**
     * 修改人员临时准入信息
     * @param dto 临时准入信息
     * @return 临时准入ID
     */
    String updatePerson(TemporaryAdmissionPersonUpdateDTO dto) throws GeneralSimpleException;

    /**
     * 新增车辆临时准入信息
     * @param dto 临时准入信息
     * @return 临时准入ID
     */
    String insertCar(TemporaryAdmissionCarSaveDTO dto) throws GeneralSimpleException;

    /**
     * 更新车辆临时准入信息
     * @param dto 临时准入信息
     * @return 临时准入ID
     */
    String updateCar(TemporaryAdmissionCarUpdateDTO dto) throws GeneralSimpleException;

    /**
     * 临时准入分页查询
     * @param dto 分页查询信息
     * @return 临时准入信息
     */
    IPage<TemporaryAdmissionPageVO> pageByTemporaryAdmission(TemporaryAdmissionPageDTO dto) throws GeneralSimpleException;

    /**
     * 提交审核
     * @param dto 审批单ID
     * @return 提交状态
     */
    Boolean submitReview(TemporaryAdmissionIdDTO dto) throws GeneralSimpleException;

    /**
     * 撤回
     * @param dto 审批单ID
     * @return 撤回状态
     */
    Boolean withdraw(TemporaryAdmissionIdDTO dto) throws GeneralSimpleException;

    /**
     * 查询人员临时准入信息
     * @param dto 审批单ID
     * @return 临时准入信息
     */
    TemporaryAdmissionPersonBaseVO findByPerson(TemporaryAdmissionIdDTO dto) throws GeneralSimpleException;

    /**
     * 查询车辆临时准入信息
     * @param dto 审批单ID
     * @return 临时准入信息
     */
    TemporaryAdmissionCarBaseVO findByCar(TemporaryAdmissionIdDTO dto) throws GeneralSimpleException;

    /**
     * 根据用户ID查询用户详细信息
     *
     * @param personList 用户ID
     * @param workId 工程ID
     * @return 用户详细信息
     */
    List<PersonSyncDetailInfoVO> findByPersonIdInAndWorkId(List<String> personList, String workId);

    /**
     * 查询可办理准入的在建工程
     * @return 工程信息
     */
    List<ConstructionWorkListVO> getWorkList() throws GeneralSimpleException;

    /**
     * 查询存在的准入
     * @param dto 查询条件
     * @return 准入信息
     */
    List<TemporaryAdmissionCheckWorkVO> findWorkAccess(TemporaryAdmissionWorkDTO dto);

    /**
     * 根据身份证号查询人员ID
     * @param card 身份证号
     * @return 人员ID
     */
    Integer findIdByCard(String card);

    /**
     * 更新审批单的准入周期
     * @param cycleStart 开始准入
     * @param cycleEnd 结束准入
     * @param associationObjId 临时准入ID
     */
    void updateCycleByObjId(Date cycleStart, Date cycleEnd, String associationObjId);
}
